{% extends 'dashboard.html' %}

{% block main %}

    <h1>文章列表</h1>
    <button type="button" class="btn btn-default navbar-btn"><a href="{% url 'article_add' %}">新增文章</a></button>
    <table class="table table-bordered table-hover">
        <thead>
        <tr>
            <th>序号</th>
            <th>id</th>
            <th>标题</th>
            <th>分类</th>
            <th>创建时间</th>
            <th>发布状态</th>
            <th>发布状态二</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for article in all_article %}
            <tr>
                <td>{{ forloop.counter }}</td>
                <td>{{ article.pk }}</td>
                <td>{{ article.title }}</td>
                <td>{{ article.category.title|default:'-' }}</td>
                <td>{{ article.creat_time|date:"Y-m-d H:i:s" }}</td>
                <td>{{ article.get_publish_status_display }}</td>
                <td>{{ article.show_publish_status }} </td>
                <td><a href="{% url 'article_edit' article.pk %}"><i class="fa fa-edit"></i></a></td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock %}